<div class="container-fluid col-8 py-5">
    <div class="row">
        <div class="col-12">
            <h2> {{ $domain->name }}</h2>
            <p> {{ $domain->description}}</p>
        </div>
        <div class="col-3">
            <div class="row mb-3">
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'main')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('main')">Главное</button>
                </div>
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'chat')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('chat')">Чат домена</button>
                </div>
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'users')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('users')">Пользователи
                    </button>
                </div>
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'teams')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('teams')">Команды</button>
                </div>
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'hirings')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('hirings')">Набор в
                        команды
                    </button>
                </div>
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'team-searches')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('team-searches')">Поиск
                        команды
                    </button>
                </div>
                <div @class(['col-12', 'bg-primary bg-opacity-10' => ($view == 'roles')])>
                    <button class="btn btn-link text-decoration-none" wire:click="switchView('roles')">Роли домена
                    </button>
                </div>
            </div>
        </div>
        <div class="col-9">
            @if( $view == 'main')
                <div class="row">
                    <div class="col-12">
                        Domain message
                    </div>
                </div>
            @endif
            @if( $view == 'chat')
                    @livewire('chat-window', ['chatMessages' => $domain->chatMessages])
            @endif
            @if( $view == 'users')
                <div class="row">
                    <div class="col-12 mb-3">
                        <input type="text" class="form-control" placeholder="Поиск.." id="searchString"
                               wire:model="searchString">
                    </div>
                    @foreach($domain->users->filter(function ($value, $key, ) use ($searchString) { return str_contains($value->user_name, $searchString); })->all() as $user)
                        @livewire('user-list-item', ['user' => $user], key('user-' . $user->id))
                    @endforeach
                </div>
            @endif
            @if( $view == 'teams')
                <div class="row">
                    <div class="col-12 mb-3">
                        <input type="text" class="form-control" placeholder="Поиск.." id="searchString"
                               wire:model="searchString">
                    </div>
                    @foreach($domain->teams->filter(function ($value, $key) use ($searchString) { return str_contains($value->name, $searchString); })->all() as $team)
                        @livewire('team-list-item', ['team' => $team], key('team-' . $team->id))
                    @endforeach
                </div>
            @endif
            @if( $view == 'hirings')
                <div class="row">
                    <div class="col-12 mb-3">
                        <input type="text" class="form-control" placeholder="Поиск.." id="searchString"
                               wire:model="searchString">
                    </div>
                    @foreach($domain->hirings->filter(function ($value, $key) use ($searchString) { return str_contains($value->description, $searchString); })->all() as $hiring)
                        @livewire('hiring-list-item', ['hiring' => $hiring], key('hiring-' . $hiring->id))
                    @endforeach
                </div>
            @endif
            @if( $view == 'team-searches')
                <div class="row">
                    <div class="col-12 mb-3">
                        <input type="text" class="form-control" placeholder="Поиск.." id="searchString"
                               wire:model="searchString">
                    </div>
                    @foreach($domain->teamSearches->filter(function ($value, $key) use ($searchString) { return str_contains($value->description, $searchString); })->all() as $teamSearch)
                        @livewire('team-search-list-item', ['teamSearch' => $teamSearch], key('team-search-' . $teamSearch->id))
                    @endforeach
                </div>
            @endif
            @if( $view == 'roles')
                <div class="row">
                    @foreach($domain->roles as $role)
                        @livewire('domain-role-list-item', ['role' => $role], key('domain-role-' . $role->id))
                    @endforeach
                </div>
            @endif
        </div>
    </div>
</div>
